<?php
namespace Dybasedev\Dataman;

use Illuminate\Database\Connection as LaravelConnection;
use RuntimeException;

class Connection extends LaravelConnection implements ConnectionInterface
{
    /**
     * Get a schema builder instance for the connection.
     *
     * @return \Illuminate\Database\Schema\Builder
     */
    public function getSchemaBuilder()
    {
        if (is_null($this->schemaGrammar)) { $this->useDefaultSchemaGrammar(); }

        return new Schema\Builder($this);
    }
    
    /**
     * Show all databases
     * 
     * @return array
     */
    public function getDatabases()
    {
        throw new RuntimeException("The driver is not support the function.");
    }

    /**
     * Show all data tables
     * 
     * @return array
     */
    public function getTables()
    {
        throw new RuntimeException("The driver is not support the function.");
    }

    /**
     * Switch database
     * 
     * @param  string   $database   Database name
     * @return $this
     */
    public function database($database, $prefix)
    {
        throw new RuntimeException("The driver is not support the function.");
    }

    /**
     * Set the table prefix in use by the connection.
     *
     * @param  string  $prefix
     * @return void
     */
    public function setTablePrefix($prefix)
    {
        parent::setTablePrefix($prefix);

        return $this;
    }

    public function getConvertBuilder()
    {
        return new Convert\Builder($this);
    }
}